home *** CD-ROM | disk | FTP | other *** search
/ CDUTIL 13 / CDUTIL #13 Julio 1995.iso / windows / acadcom / acrx / sample / dragger.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-08  |  21.9 KB  |  695 lines

  1. /* Next available MSG number is  21 */
  2.  
  3. /***************************************************************************
  4.    Module Name:  dragger.cc
  5.  
  6.    Copyright (C) 1994 by Autodesk, Inc.
  7.  
  8.    Permission to use, copy, modify, and distribute this software in 
  9.    object code form for any purpose and without fee is hereby granted, 
  10.    provided that the above copyright notice appears in all copies and 
  11.    that both that copyright notice and the limited warranty and 
  12.    restricted rights notice below appear in all supporting 
  13.    documentation.
  14.  
  15.    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  
  16.    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 
  17.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  18.    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 
  19.    UNINTERRUPTED OR ERROR FREE.
  20.  
  21.    Use, duplication, or disclosure by the U.S. Government is subject to 
  22.    restrictions set forth in FAR 52.227-19 (Commercial Computer 
  23.    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 
  24.    (Rights in Technical Data and Computer Software), as applicable.
  25.     
  26.    .
  27.  
  28.    Description:Another Sample ADS application
  29.  
  30.    Author     : 
  31.                  Autodesk, Inc.
  32.                  2320 Marinship Way
  33.                  Sausalito, CA. 94965
  34.                  (415)332-2344
  35.  
  36.    This Arx application is a conversion from the original sample ADS app
  37.    dragger.c.
  38.  
  39.     CREATED BY:  William Howison, January 1994
  40.  
  41.     What it tests :
  42.  
  43.     - ads_draggen function.
  44.  
  45.     Function Entry Points: 
  46.       AcRx::AppRetCode
  47.         acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt);
  48.  
  49.     Exported ADS Functions
  50.         TESTDRAGGEN               [Test the ADS_DRAGGEN function]
  51.  
  52.     Modification History:
  53.         Jan 31 1994 - bch - original creation
  54.         Feb 14 1994 - jkt - ads_ssget & prompts usage, RSRSLT return value
  55.  
  56.     Notes and restrictions on use:
  57.  
  58.  
  59. ***************************************************************************/
  60.  
  61. /**************************************************************************/
  62. /*  MODULE NAME  */
  63. /**************************************************************************/
  64. #define    DRAGGER
  65.  
  66. /****************************************************************************/
  67. /*  DEFINES  */
  68. /****************************************************************************/
  69. #define ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
  70.  
  71. /**************************************************************************/
  72. /*  TYPEDEFS  */
  73. /**************************************************************************/
  74. /* ADS Function Table */
  75. typedef struct {
  76.     char    *name;
  77.     int     (*fptr)();
  78. } ftblent;
  79.  
  80. typedef struct resbuf rbtype;
  81.  
  82. /**************************************************************************/
  83. /*  INCLUDES  */
  84. /**************************************************************************/
  85.  
  86. #include <stdio.h>
  87. #include <string.h>
  88. #include <math.h>
  89. #include "ol_errno.h"
  90. #include "rxdefs.h"
  91. #include "adslib.h"
  92.  
  93. extern "C" {
  94. /****************************************************************************/
  95. /*  LOCALLY DEFINED ENTRY POINT INVOKED BY Arx                               */
  96. /****************************************************************************/
  97. AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void* );
  98.  
  99. }                                                                 
  100.  
  101.  
  102. /****************************************************************************/
  103. /*  LOCAL FUNCTION FORWARD DECLARATIONS  */
  104. /****************************************************************************/
  105. int     testdraggen();
  106. int     dragsampler _((ads_point pt, ads_matrix mat));
  107.  
  108.  
  109. /**************************************************************************/
  110. /*  GLOBAL VARIABLES  */
  111. /**************************************************************************/
  112. /* Table of ADS functions */
  113. ftblent exfun[] = {
  114.             {/*MSG0*/"C:TESTDRAGGEN", testdraggen},
  115.         };
  116.  
  117. /* Table of keyword functions */
  118. char *kwtab[] = {
  119.                   /*MSG0*/"Mxyz",
  120.                   /*MSG0*/"Sxyz",
  121.                   /*MSG0*/"rX",
  122.                   /*MSG0*/"rY",
  123.                   /*MSG0*/"rZ",
  124.                   /*MSG0*/"Nop",
  125.                   /*MSG0*/"Exit",
  126.  
  127.                  };
  128.  
  129. ads_matrix ads_identmat = {
  130.     {1.0, 0.0, 0.0, 0.0},
  131.     {0.0, 1.0, 0.0, 0.0},
  132.     {0.0, 0.0, 1.0, 0.0},
  133.     {0.0, 0.0, 0.0, 1.0}
  134. };
  135.  
  136. #define MXYZ 0
  137. #define SXYZ 1
  138. #define RX   2
  139. #define RY   3
  140. #define RZ   4
  141. #define NOP  5
  142. #define EXIT 6
  143.  
  144. /* THEST DEFINES SHOULD BE REMOVED AFTER THE HEADER FILES ARE REDONE */
  145. #define RSG_NONULL 0x01               /* Disallow null input */
  146. #define RSG_NOZERO 0x02               /* Disallow zero input */
  147. #define RSG_NONEG  0x04               /* Disallow negative input */
  148. #define RSG_NOLIM  0x08               /* Do not check limits */
  149. #define RSG_GETZ   0x10               /* Get Z coordinate */
  150. #define RSG_DASH   0x20               /* Draw dashed rubber band/box */
  151. #define RSG_2D     0x40               /* Restrict (getdist) to 2D */
  152. #define RSG_OTHER  0x80               /* Return input string if unknown */
  153.  
  154. int       KwIndex = NOP;              /* Index into kwtab */
  155. ads_point Base;                       /* Base point for xform */
  156.  
  157. ads_matrix     CTM;                   /* Current Transformation Matrix */
  158. /**************************************************************************/
  159. /*  EXTERNAL FUNCTION DECLARATIONS  */
  160. /**************************************************************************/
  161.  
  162. /**************************************************************************/
  163. /*  EXTERNAL VARIABLE DECLARATIONS  */
  164. /**************************************************************************/
  165.  
  166. /****************************************************************************/
  167. /*  LOCAL FUNCTION DECLARATIONS  */
  168. /****************************************************************************/
  169. int funcload       _((void));
  170. int funcunload     _((void));
  171. int dofun          _((void));
  172. int geterrno       _((void));
  173. void ads_mat_ident _((ads_matrix matrix));
  174. void ads_subvec    _((ads_point ap, ads_point bp, ads_point dp));
  175. ads_real ads_fabsv _((ads_point ap));
  176. ads_real ads_dist  _((ads_point p1, ads_point p2));
  177. void ads_mat_rot   _((ads_real angle, int axis, ads_matrix m));
  178. void ads_mat_scale _((ads_real xscale, ads_real yscale, ads_real zscale,
  179.                       ads_matrix m));
  180. void ads_mat_x_vec _((ads_matrix mat, ads_point pin, ads_point pout));
  181. void ads_mat_x_pt  _((ads_matrix mat, ads_point pin, ads_point pout));
  182.  
  183. /******************************************************************************/
  184. /*.doc geterrno(internal) */
  185. /*+
  186.     This function is called to obtain the value of the AutoCAD system
  187.     variable ERRNO and return it as a result.
  188. -*/
  189. /******************************************************************************/
  190. int
  191. /*FCN*/geterrno()
  192. {
  193.     rbtype errval;
  194.  
  195.     ads_getvar(/*MSG0*/"ERRNO", &errval);
  196.  
  197.     return errval.resval.rint;
  198. }
  199.  
  200. /******************************************************************************/
  201. /*.doc funcload(internal) */
  202. /*+
  203.     This function is called to define all function names in the ADS
  204.     function table.  Each named function will be callable from lisp or
  205.     invokable from another ADS application.
  206. -*/
  207. /******************************************************************************/
  208. int
  209. /*FCN*/funcload()
  210. {
  211.     int i;
  212.  
  213.     for (i = 0; i < ELEMENTS(exfun); i++) {
  214.         if (!ads_defun(exfun[i].name, i))
  215.             return RTERROR;
  216.     }
  217.  
  218.     return RTNORM;
  219. }
  220.  
  221. /******************************************************************************/
  222. /*.doc funclunoad(internal) */
  223. /*+
  224.     This function is called to undefine all function names in the ADS
  225.     function table.  Each named function will be removed from the
  226.     AutoLISP hash table.
  227. -*/
  228. /******************************************************************************/
  229. int
  230. /*FCN*/funcunload()
  231. {
  232.     int i;
  233.  
  234.     /* Undefine each function we defined */
  235.  
  236.     for (i = 0; i < ELEMENTS(exfun); i++) {
  237.         ads_undef(exfun[i].name,i);
  238.     }
  239.  
  240.     return RTNORM;
  241. }
  242. /******************************************************************************/
  243. /*.doc dofun(internal) */
  244. /*+
  245.     This function is called to invoke the function which has the
  246.     registerd function code that is obtained from  ads_getfuncode.  The
  247.     function will return RTERROR if the function code is invalid, or
  248.     RSERR if the invoked function fails to return RTNORM.  The value
  249.     RSRSLT will be returned if the function code is valid and the
  250.     invoked subroutine returns RTNORM.
  251. -*/
  252. /******************************************************************************/
  253. int
  254. /*FCN*/dofun()
  255. {
  256.     int val;
  257.  
  258.     if ((val = ads_getfuncode()) < 0 || val > ELEMENTS(exfun))
  259.         return RTERROR;
  260.  
  261.     return ((*exfun[val].fptr)() == RSRSLT ? RSRSLT : RSERR);
  262. }
  263.  
  264. /******************************************************************************/
  265. /*.doc ads_mat_ident(internal) */
  266. /*+
  267.     Set up an identity matrix.
  268. -*/
  269. /******************************************************************************/
  270. void
  271. /*FCN*/ads_mat_ident(ads_matrix matrix)
  272. {
  273.     memcpy(matrix, ads_identmat, sizeof(ads_matrix));
  274. }
  275.  
  276. /******************************************************************************/
  277. /*.doc ads_subvec(internal) */
  278. /*+
  279.     Subtract two ads_points.
  280. -*/
  281. /******************************************************************************/
  282. void
  283. /*FCN*/ads_subvec(ads_point ap, ads_point bp, ads_point dp)
  284. {
  285.     dp[X] = ap[X] - bp[X];
  286.     dp[Y] = ap[Y] - bp[Y];
  287.     dp[Z] = ap[Z] - bp[Z];
  288. }
  289.  
  290.  
  291. /******************************************************************************/
  292. /*.doc ads_fabsv(internal) */
  293. /*+
  294.     Get normal of a vector.
  295. -*/
  296. /******************************************************************************/
  297. ads_real
  298. /*FCN*/ads_fabsv(ads_point ap)
  299. {
  300.     return sqrt(ap[X] * ap[X] + ap[Y] * ap[Y] + ap[Z] * ap[Z]);
  301. }
  302.  
  303. /******************************************************************************/
  304. /*.doc ads_dist(internal) */
  305. /*+
  306.     Calculate distance between two points.
  307. -*/
  308. /******************************************************************************/
  309. ads_real
  310. /*FCN*/ads_dist(ads_point p1, ads_point p2)
  311. {
  312.     ads_point pd;
  313.  
  314.     ads_subvec(p1, p2, pd);
  315.     return ads_fabsv(pd);
  316. }
  317.  
  318.  
  319. /******************************************************************************/
  320. /*.doc ads_mat_ixlate(internal) */
  321. /*+
  322.     Set up a translation matrix.
  323. -*/
  324. /******************************************************************************/
  325. void
  326. /*FCN*/ads_mat_ixlate(ads_point vec, ads_matrix result)
  327. {
  328.     ads_mat_ident(result);
  329.     result[X][T] = - vec[X];
  330.     result[Y][T] = - vec[Y];
  331.     result[Z][T] = - vec[Z];
  332. }
  333.  
  334. /******************************************************************************/
  335. /*.doc ads_mat_rot(internal) */
  336. /*+
  337.     Generate a matrix that rotates about a given axis.
  338. -*/
  339. /******************************************************************************/
  340. void
  341. /*FCN*/ads_mat_rot(ads_real angle, int axis, ads_matrix m)
  342. {
  343.     int axp1, axp2;
  344.  
  345.     axp1 = (axis + 1) % 3;
  346.     axp2 = (axis + 2) % 3;
  347.     ads_mat_ident(m);
  348.     m[axp1][axp1] = m[axp2][axp2] = cos(angle);
  349.     m[axp1][axp2] = -(m[axp2][axp1] = sin(angle));
  350. }
  351.  
  352. /******************************************************************************/
  353. /*.doc ads_mat_scale(internal) */
  354. /*+
  355.     Generate a matrix that scales the 3 axes by given amounts.
  356. -*/
  357. /******************************************************************************/
  358. void
  359. /*FCN*/ads_mat_scale(ads_real xscale, ads_real yscale, ads_real zscale, ads_matrix m)
  360. {
  361.     ads_mat_ident(m);
  362.     m[X][X] = xscale;
  363.     m[Y][Y] = yscale;
  364.     m[Z][Z] = zscale;
  365. }
  366.  
  367. /******************************************************************************/
  368. /*.doc ads_mat_x_pt(internal) */
  369. /*+
  370.     Multiply matrix by a given point.  Note that it does translation.
  371. -*/
  372. /******************************************************************************/
  373. void
  374. /*FCN*/ads_mat_x_pt(ads_matrix mat, ads_point pin, ads_point pout)
  375. {
  376.     int i;
  377.     ads_point temp;
  378.  
  379.     for (i = X; i <= Z; i++)
  380.         temp[i] = mat[i][X] * pin[X] +
  381.                   mat[i][Y] * pin[Y] +
  382.                   mat[i][Z] * pin[Z] +
  383.                   mat[i][T];
  384.     memcpy(pout, temp, sizeof(ads_point));
  385. }
  386.  
  387. /******************************************************************************/
  388. /*.doc ads_mat_x_vec(internal) */
  389. /*+
  390.     Multiply matrix by a given vector.  Note that it does NO translation.
  391. -*/
  392. /******************************************************************************/
  393. void
  394. /*FCN*/ads_mat_x_vec(ads_matrix mat, ads_point pin, ads_point pout)
  395. {
  396.     int i;
  397.     ads_point temp;
  398.  
  399.     for (i = X; i <= Z; i++)
  400.         temp[i] = mat[i][X] * pin[X] +
  401.                   mat[i][Y] * pin[Y] +
  402.                   mat[i][Z] * pin[Z];
  403.     memcpy(pout, temp, sizeof(ads_point));
  404. }
  405.  
  406. /******************************************************************************/
  407. /*.doc ads_mat_x_mat(internal) */
  408. /*+
  409.     Multiply two matrices.  Any or all arguments may point to the same array.
  410. -*/
  411. /******************************************************************************/
  412. void
  413. /*FCN*/ads_mat_x_mat(ads_matrix mata, ads_matrix matb, ads_matrix matout)
  414. {
  415.     ads_matrix t;
  416.     int i, j, k;
  417.     ads_real sum;
  418.  
  419.     for (i = 0; i < 4; i++)
  420.         for (j = 0; j < 4; j++) {
  421.             sum = 0.0;
  422.             for (k=0; k<4; k++)
  423.                 sum += mata[i][k] * matb[k][j];
  424.             t[i][j] = sum;
  425.         }   
  426.     memcpy(matout, t, sizeof(ads_matrix));
  427. }
  428.  
  429.   
  430. /******************************************************************************/
  431. /*.doc dragsampler(internal) */
  432. /*+
  433.     ADS_DRAGGEN sampler function.  This function is called every time the
  434.     digitizer is moved.  It receives two arguments, the first is pt, and
  435.     the second is mat.  The argument pt is the current digitizer location,
  436.     and the arguemnt mat is the transformation matrix which is being used
  437.     by AutoCAD to display the current selection set of objects.
  438.  
  439.     The global KwIndex is an integer variable which contains a code
  440.     representing the current drag mode.  The possible values are MXYZ,
  441.     SXYZ, RX, RY, RZ, NOP, and EXIT.  This variable is set in the function
  442.     testdraggen.
  443.  
  444.     The global CTM is set to the value of the argument mat before
  445.     returning from the dragsampler.  This variable is used by testdraggen
  446.     when performing an ADS_XFORSS call.
  447. -*/
  448. /******************************************************************************/
  449. int
  450. /*FCN*/dragsampler(ads_point pt, ads_matrix mat)
  451. {
  452.  
  453.     ads_real        D;
  454.     ads_real        angle;
  455.     ads_point       tp;
  456.     int             axis;
  457.  
  458.     switch(KwIndex) {
  459.     case MXYZ:
  460.         /* generate translation matrix */
  461.         ads_subvec(pt, Base, tp);
  462.         ads_mat_x_vec(mat, tp, tp);
  463.         mat[X][T] = tp[X];
  464.         mat[Y][T] = tp[Y];
  465.         mat[Z][T] = tp[Z];
  466.  
  467.         break;
  468.  
  469.     case SXYZ:
  470.         /* generate uniformly scaled matrix */
  471.         D = ads_dist(pt, Base);
  472.         if (D < .0001)
  473.             D = .0001;
  474.         ads_mat_scale(D,D, D, mat);
  475.  
  476.         /* calculate new translation point */
  477.         ads_mat_x_vec(mat, Base, tp);
  478.         ads_subvec(Base, tp, tp);
  479.         mat[X][T] = tp[X];
  480.         mat[Y][T] = tp[Y];
  481.         mat[Z][T] = tp[Z];
  482.  
  483.         break;
  484.  
  485.     case RX:
  486.     case RY:
  487.     case RZ:
  488.         switch (KwIndex) {
  489.         case RX:
  490.             axis = X;
  491.             break;
  492.         case RY:
  493.             axis = Y;
  494.             break;
  495.         case RZ:
  496.             axis = Z;
  497.             break;
  498.         }
  499.  
  500.  
  501.         /* calculate angle of line between LastPoint and tp */
  502.         ads_subvec(pt, Base, tp);
  503.         angle = ads_angle(Base, pt);
  504.  
  505.         /* generate rotation matrix about axis */
  506.         ads_mat_rot(angle, axis, mat);
  507.  
  508.         /* calculate new translation point */
  509.         ads_mat_x_vec(mat, Base, tp);
  510.         ads_subvec(Base, tp, tp);
  511.         mat[X][T] = tp[X];
  512.         mat[Y][T] = tp[Y];
  513.         mat[Z][T] = tp[Z];
  514.  
  515.         break;
  516.     case EXIT:
  517.         return RTCAN;
  518.     case NOP:
  519.     default:
  520.         return RTNONE;
  521.     }
  522.  
  523.     memcpy(CTM, mat, sizeof(ads_matrix));
  524.     return RTNORM;
  525. }
  526.  
  527. /******************************************************************************/
  528. /*.doc testdraggen(internal) */
  529. /*+
  530.     This function is called from dofun as a result of an RQSUBR
  531.     request being sent to the main dispatch loop.
  532.  
  533.     It instructs the user to select the set of entitis that will be
  534.     dragged by the ads_draggen function.  The selection is obtained by
  535.     performing an ads_ssget Crossing.  If a selection set contains one
  536.     or more entities, then the user will be instructed to move the
  537.     mouse for dragging the object(s), or enter a keyword to modify the
  538.     behavior of the dragging operation.
  539.  
  540.     The list of keywords is obtained from the keytable, and each
  541.     keyword in the table has a different affect on the sampler function.
  542.     The sampler will perform the transformation indicated by the value of
  543.     KwIndex.
  544.  
  545.     Once a valid point has been selected, this test function will
  546.     attempt to transform the selection set of entities in the database.
  547.     The transformation will not work if the transformation matrix
  548.     contains a non uniform scale.
  549.  
  550.     The return value for this function is the last value in rc.
  551. -*/
  552. /******************************************************************************/
  553. int
  554. /*FCN*/testdraggen()
  555. {
  556.     int         x;
  557.     int         rc;
  558.     long        slen = 0;
  559.     ads_point   pt3;
  560.     ads_name    ssname;
  561.     rbtype      *args;
  562.     char        tstr[512];
  563.     char        kwlist[128];
  564.     char        kwprompt[128];
  565.     char        draggenprompt[512];
  566.     int         cur;
  567.  
  568.     args = ads_getargs();
  569.     ads_mat_ident(CTM);
  570.     cur = 0;
  571.     /* Build the key word list from the key word table */
  572.     kwlist[0] = '\0';
  573.     kwprompt[0] = '\0';
  574.     for (x = 0; x < ELEMENTS(kwtab); x++) {
  575.         if (x != 0) {
  576.             strcat(kwlist, /*MSG0*/" ");
  577.             strcat(kwprompt, "/");
  578.         }
  579.         strcat(kwlist, kwtab[x]);
  580.         strcat(kwprompt, kwtab[x]);
  581.     }
  582.  
  583.     /* Select entities for DRAGGEN test */
  584.     ads_printf(/*MSG3*/"\nPerforming ads_draggen test\n");
  585.     if (args != NULL) {
  586.         ads_printf(/*MSG4*/"I don't need any arguments from you.\n");
  587.         ads_retlist(args);
  588.     }
  589.     KwIndex = NOP;
  590.     ads_printf(/*MSG5*/"Select entities to be dragged ...\n");
  591.     rc = ads_ssget(NULL, NULL, NULL, NULL, ssname);
  592.     // DEBUG did these lines get doubled?
  593.     // if (rc != RTNORM || slen == 0L)
  594.     //     return RSRSLT;
  595.     rc = ads_sslength(ssname, &slen);
  596.     if (rc != RTNORM || slen == 0L)
  597.         return RSRSLT;
  598.     ads_getpoint(NULL, /*MSG8*/"\nSelect base point: ", Base);
  599.     sprintf(draggenprompt, /*MSG9*/"\nMove mouse or enter (%s): ", kwprompt);
  600.     do {
  601.         ads_initget(RSG_NONULL|RSG_OTHER, kwlist);
  602.         rc = ads_draggen(ssname,
  603.                          draggenprompt,
  604.                          cur,
  605.                          dragsampler,
  606.                          pt3);
  607.         switch (rc) {
  608.         case RTKWORD:
  609.             ads_getinput(tstr);
  610.             rc = RTNORM;
  611.             for (x = 0; x < ELEMENTS(kwtab); x++) {
  612.                 if (strcmp(tstr, kwtab[x]) == 0) {
  613.                     KwIndex = x;
  614.                     ads_mat_ident(CTM);
  615.                     break;
  616.                 }
  617.             }
  618.             if (x >= ELEMENTS(kwtab))
  619.                 ads_printf(/*MSG10*/"\n%s is invalid keyword.", tstr);
  620.             break;
  621.         case RTSTR:
  622.             ads_getinput(tstr);
  623.             rc = RTNORM;
  624.             ads_printf(/*MSG11*/"You entered :%s\n", tstr);
  625.             break;
  626.         case RTNORM:
  627.             rc = ads_xformss(ssname, CTM);
  628.             if (rc != RTNORM)
  629.                 switch(geterrno()) {
  630.                 case OL_ESSVALID:
  631.                     ads_printf(/*MSG12*/"\nInvalid selection set.\n");
  632.                     break;
  633.                 case OL_EDELENT:
  634.                     ads_printf(/*MSG13*/"\nSelection set contains deleted entity.\n");
  635.                     break;
  636.                 case OL_EMODSEQ:
  637.                     ads_printf(/*MSG14*/"\nCan't xform a SEQEND entity.\n");
  638.                     break;
  639.                 case OL_ERGBUSY:
  640.                     ads_printf(/*MSG15*/"\nComplex regen in progress.\n");
  641.                     break;
  642.                 case OL_EMMVPORT:
  643.                     ads_printf(/*MSG16*/"\nCan't xform vport entity.\n");
  644.                     break;
  645.                 case OL_EMMLL:
  646.                     ads_printf(/*MSG17*/"\nCan't xform entity on locked layer.\n");
  647.                     break;
  648.                 case OL_EXFMVALID:
  649.                     ads_printf(/*MSG18*/"\nInvalid transformation matrix.\n");
  650.                     break;
  651.                 }
  652.  
  653.             ads_mat_x_pt(CTM, Base, Base);
  654.             ads_mat_ident(CTM);
  655.             break;
  656.         case RTCAN:
  657.             ads_printf(/*MSG19*/"\nThe drag was aborted\n");
  658.             break;
  659.         case RTERROR:
  660.         default:
  661.             ads_printf(/*MSG20*/"\nDrag operation failed\n");
  662.             break;
  663.         }
  664.     } while (rc == RTNORM);
  665.     /* release the selection set */
  666.     ads_ssfree(ssname);
  667.  
  668.     return RSRSLT;
  669. }
  670.  
  671. AcRx::AppRetCode
  672. /*FCN*/acrxEntryPoint(AcRx::AppMsgCode msg, void * )
  673. {
  674.  
  675.     switch(msg) {
  676.         case AcRx::kInitAppMsg:
  677.             break;
  678.         case AcRx::kInvkSubrMsg:
  679.             dofun();
  680.             break;
  681.         case AcRx::kLoadADSMsg:
  682.             funcload();
  683.             break;
  684.         case AcRx::kUnloadADSMsg:
  685.             funcunload();
  686.             ads_printf(/*MSG2*/"Unloading.\n");
  687.             break;
  688.         case AcRx::kUnloadAppMsg:
  689.         default:
  690.             break;
  691.     }
  692.     return AcRx::kRetOK;
  693. }
  694.  
  695.